// let getter = new Proxy(data, {
//   get(target, key, receiver) {
//     return Reflect.get(target, key, receiver)
//   }
// })

// export default getter

function reactive(data, cb) {
  let timer = null
  return new Proxy(data, {
    get(target, key, receiver) {
      console.log('get value', key) 
      return Reflect.get(target, key, receiver)
    },
    set(target, key, value, receiver) {
      console.log('set value', key, value) 
      clearTimeout(timer)
      timer = setTimeout(() => {
        cb && cb()
      },0)
      return Reflect.set(target, key, value, receiver)
    }
  })
}

let data = [1,2,3]
let a = reactive(data,() => {
  console.log('traget')
})

a.push(0)